package com.yssoft.service.supervise;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.yssoft.entity.core.TEnterprise;
import com.yssoft.entity.supplier.BillCountCustom;
import com.yssoft.entity.supplier.ProductionBatch;
import com.yssoft.entity.supplier.ProductionBatchCustom;
import com.yssoft.mapper.supplier.ProductionBatchMapper;
import com.yssoft.utils.LayuiUtil;

@Service
public class ProductionBatchService {
	@Resource
	private ProductionBatchMapper productionBatchMapper;

	public JSONObject queryProductionBatchPage(int page, int limit, ProductionBatch custom) throws IllegalAccessException, ClassNotFoundException {
		 PageHelper.startPage(page,limit);//下面第一个查询结果进行分页
	        //当参数为空处理，防止空指针报错
	        if(custom==null ) {
	        	custom=new ProductionBatch();
	        }
	        //查询分页数据
	        List<ProductionBatchCustom> list =productionBatchMapper.selectProductionBatchPage(custom);
	        //查询总条数
	        int count = productionBatchMapper.selectProductionBatchPageCount(custom);
	        JSONObject jsonObject =LayuiUtil.getJSONObjectByObject(list,count,"","");
	        return jsonObject;
	}
	
}
